package com.ruihu.admin.module.business.node.config.domain.vo;

import com.ruihu.admin.module.business.node.config.domain.dto.TaskProcessConfigDTO;
import lombok.Data;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;

/**
 *  [ 节点配置表 ]
 *
 * @author Tony
 * @version 1.0
 * @company 瑞虎（南京）信息技术有限公司
 * @copyright (c) 瑞虎（南京）信息技术有限公司Inc. All rights reserved.
 * @date  2023-01-02 16:31:04
 * @since JDK1.8
 */

@Data
public class TaskProcessConfigVO {

    @ApiModelProperty("id")
    private Long id;

    @ApiModelProperty("配置名称")
    private String name;

    @ApiModelProperty("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty("创建人")
    private Long creator;

    @ApiModelProperty("更新人")
    private Long updater;

    @ApiModelProperty("创建人名称")
    private String createByName;

    @ApiModelProperty("更新人名称")
    private String updateByName;

    @ApiModelProperty("值类型 1:输入值; 2:下拉框")
    private Integer type;

    @ApiModelProperty("值类型名称 1:输入值; 2:下拉框")
    private String typeName;

    @ApiModelProperty("是否有异常描述 0否 1是")
    private Integer isThrowDesc;

    @ApiModelProperty("异常描述 0否 1是")
    private String isThrowDescName;

    @ApiModelProperty("是否有图片 0否 1是")
    private Integer hasImage;

    @ApiModelProperty("是否有图片 0否 1是")
    private String hasImageName;

    @ApiModelProperty("接口获取照片 0否 1是")
    private Integer interfaceImage;

    @ApiModelProperty("接口获取照片 0否 1是")
    private String interfaceImageName;

    @ApiModelProperty("是否固定元素 0否 1是")
    private Integer fixed;

    @ApiModelProperty("是否固定元素")
    private String fixedDesc;

    @ApiModelProperty("任务节点ID")
    private Long taskNodeId;

    @ApiModelProperty("任务节点名称")
    private String taskNodeName;

    @ApiModelProperty("是否其他 0否 1是")
    private Integer isOther;

    @ApiModelProperty("是否其他")
    private String isOtherDesc;

    @ApiModelProperty("单位")
    private String unit;


    public static TaskProcessConfigVO convertToTaskProcessConfigVO(TaskProcessConfigDTO dto) {
        if (dto == null){
            return null;
        }
        TaskProcessConfigVO vo = new TaskProcessConfigVO();
        vo.setId(dto.getId());
        vo.setName(dto.getName());
        vo.setCreateTime(dto.getCreateTime());
        vo.setUpdateTime(dto.getUpdateTime());
        vo.setCreator(dto.getCreator());
        vo.setUpdater(dto.getUpdater());
        vo.setType(dto.getType());
        vo.setIsThrowDesc(dto.getIsThrowDesc());
        vo.setHasImage(dto.getHasImage());
        vo.setFixed(dto.getFixed());
        vo.setTaskNodeName(dto.getTaskNodeName());
        vo.setUnit(dto.getUnit());
        return vo;
    }
}
